<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page isELIgnored="false" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html style="overflow-y: visible;">
    <jsp:include page="../../../include/IncludeMain.jsp"></jsp:include>
  	<body style="overflow-y: visible;" onload="changeRowColor();">
  	<table class="mainTable">
		<thead>
			<tr class="tableController">
				<th colspan="10">
					<h3>开料明细列表</h3>
					<div class="tableControllerButton">
						<c:if test="${produceViewList[0].status != 1}">
							<a class="button" href="javascript:void(0)" onclick="this.blur(); window.location='${pageContext.request.contextPath }/pages/business/Cutting.do?act=get&order_shoe_id=${order_shoe_id }'; return false;"><span><img src="${pageContext.request.contextPath }/js/kui/icons/application_add.png" align="absmiddle"/>&nbsp;添加</span></a>
							<a class="button" href="javascript:void(0)" onclick="this.blur(); window.location='${pageContext.request.contextPath }/pages/business/CancelOut.do?act=add&order_shoe_id=${produceViewList[0].id }'; return false;"><span><img src="${pageContext.request.contextPath }/js/kui/icons/application_add.png" align="absmiddle"/>&nbsp;加入冲单</span></a>
							<a class="button" href="javascript:void(0)" onclick="this.blur(); deleteAll(); 'return false';"><span><img src="${pageContext.request.contextPath }/js/kui/icons/application_delete.png" align="absmiddle"/>&nbsp;删除</span></a>
						</c:if>
						<a class="button" href="javascript:void(0)" onclick="this.blur(); history.go(-1);'return false';"><span><img src="${pageContext.request.contextPath }/js/kui/icons/anticlockwise.png" align="absmiddle"/>&nbsp;返回</span></a>
					</div>
				</th>
			</tr>
			<tr><td colspan="10">
				<table class="mainTable">
					<tbody>
						<tr>
							<td><h4>单号</h4></td>
							<td>${produceViewList[0].order_id}</td>
							<td><h4>下单日期</h4></td>
							<td>${produceViewList[0].order_date}</td>
							<td><h4>交货日期</h4></td>
							<td>${produceViewList[0].delivery_date}</td>
						</tr>
						<tr>
							<td><h4>品牌</h4></td>
							<td>${produceViewList[0].brand}</td>
							<td><h4>款号</h4></td>
							<td>${produceViewList[0].style_id}</td>
							<td><h4>楦号</h4></td>
							<td>${produceViewList[0].model_id}</td>
						</tr>
						<tr>
							<td><h4>材质、颜色</h4></td>
							<td>${produceViewList[0].product_color}</td>
							<td><h4>工厂序号</h4></td>
							<td>${produceViewList[0].factory_series}</td>
							<td><h4>下单号</h4></td>
							<td>${produceViewList[0].order_num}</td>
						</tr>
						<tr>
							<td><h4>配码</h4></td>
							<td style="width:300px;font-weight:bold;">${produceViewList[0].size_33}&nbsp;|&nbsp;${produceViewList[0].size_34}&nbsp;|&nbsp;${produceViewList[0].size_35}&nbsp;|&nbsp;${produceViewList[0].size_36}&nbsp;|&nbsp;${produceViewList[0].size_37}&nbsp;|&nbsp;${produceViewList[0].size_38}&nbsp;|&nbsp;${produceViewList[0].size_39}&nbsp;|&nbsp;${produceViewList[0].size_40}</td>
							<td><h4>状态</h4></td>
							<td>${0 == produceViewList[0].status? "未完成":"已完成"}</td>
							<td></td>
							<td></td>
						</tr>
						<tr>
							<td><h4>完成冲单</h4><!-- 显示把冲单的半成品鞋子加入新订单中的8种配码的数量 -->
							<td style="width:300px;font-weight:bold;">${canceled[0]}&nbsp;|&nbsp;${canceled[1]}&nbsp;|&nbsp;${canceled[2]}&nbsp;|&nbsp;${canceled[3]}&nbsp;|&nbsp;${canceled[4]}&nbsp;|&nbsp;${canceled[5]}&nbsp;|&nbsp;${canceled[6]}&nbsp;|&nbsp;${canceled[7]}</td>
						</tr>
					</tbody>
				</table>
			</td></tr>
			<tr class="tableTitle">
				<th>
					<h3>材料料号</h3>
				</th>
				<th>
					<h3>材料名称</h3>
				</th> 
				<th>
					<h3>单位用量</h3>
				</th> 
				<th>
					<h3>总用量</h3>
				</th>
				<c:if test="${produceViewList[0].status != 1}">
				<th>
					<h3>已开料</h3>
				</th>
				<th>
					<h3>未开料</h3>
				</th>
				<th>
					<h3>现有库存</h3>
				</th>
				<th>
					<h3>库存差</h3>
				</th> 
				</c:if>
				<th>
					<h3>单位</h3>
				</th> 
				<th>
					<h3>供应商</h3>
				</th>            
			</tr>
		</thead>
		<tbody>
			<c:forEach items="${produceViewList}" var="produceView">
				<c:if test="${produceView.id!= 0}">
					<tr>
						<td>${produceView.material_id}</td>
						<td>${produceView.material_name}</td>
						<td>${produceView.amount}</td>
						<td>${produceView.amount*(produceView.size_33 + produceView.size_34 + produceView.size_35 + produceView.size_36 + produceView.size_37 + produceView.size_38 + produceView.size_39 + produceView.size_40)}</td>
						<c:if test="${produceView .status != 1}">
							<td>${produceView.amount*total}</td>
							<td>${produceView.amount*(produceView.size_33 + produceView.size_34 + produceView.size_35 + produceView.size_36 + produceView.size_37 + produceView.size_38 + produceView.size_39 + produceView.size_40-total)}</td>
							<td>${produceView.repertory}</td>
							<td>${produceView.repertory-produceView.amount*(produceView.size_33 + produceView.size_34 + produceView.size_35 + produceView.size_36 + produceView.size_37 + produceView.size_38 + produceView.size_39 + produceView.size_40 - total)}</td>
						</c:if>
						<td>${produceView.unit}</td>
						<td title="电话：${produceView.supplier_telephone }，地址：${produceView.supplier_address }">${produceView.supplier}</td>
					</tr>
				</c:if>
			</c:forEach>
		</tbody>
	</table>
	<table class="mainTable">
		<thead>
			<tr class="tableTitle">
				<th>
					<h3><input type="checkbox" onclick="selectAll(this);"/></h3>
				</th>
				<th>
					<h3>项目</h3>
				</th>
				<th colspan="8">
					<center><h3>配码</h3></center>
				</th> 
				<th>
					<center><h3>合计</h3></center>
				</th> 
				<th>
					<center><h3>日期</h3></center>
				</th>
				<th>
					<center><h3>状态</h3></center>
				</th>
				<th>
					<h3>操作</h3>
				</th>                  
			</tr>
		</thead>
		<tbody>
			<form action="${pageContext.request.contextPath }/pages/business/Cutting.do?act=del&order_shoe_id=${order_shoe_id }" name="myForm" id="myForm" method="post">
				<c:forEach items="${pager.data}" var="cutting" varStatus="s">
					<c:if test="${cutting.id!= 0}">
						<tr>
							<td width="20px"><input type="checkbox" name="id" value="${cutting.id}"/></td>
							<td>${s.index+1}</td>
							<td><h5>${cutting.size_33}</h5></td>
							<td><h5>${cutting.size_34}</h5></td>
							<td><h5>${cutting.size_35}</h5></td>
							<td><h5>${cutting.size_36}</h5></td>
							<td><h5>${cutting.size_37}</h5></td>
							<td><h5>${cutting.size_38}</h5></td>
							<td><h5>${cutting.size_39}</h5></td>
							<td><h5>${cutting.size_40}</h5></td>
							<td style="color:#ff0000"><center><h5>${cutting.size_33 + cutting.size_34 + cutting.size_35 + cutting.size_36 + cutting.size_37 + cutting.size_38 + cutting.size_39 + cutting.size_40}</h5></center></td>
							<td><h5 style="text-align: center;">${cutting.date}</h5></td>
							<td><center>
										<c:if test="${cutting.status == 0}">未开料</c:if>
										<c:if test="${cutting.status == 1}">正在开料</c:if>
										<c:if test="${cutting.status == 2}">完成开料</c:if>
							</center></td>
							<td>	
								
								<c:if test="${cutting.status == 0}">
									<a class="button-small" href="javascript:void(0)" onclick="this.blur(); window.location='${pageContext.request.contextPath }/pages/business/Cutting.do?act=save&cutting.id=${cutting.id }&order_shoe_id=${order_shoe_id }&status=1'; return false;"><span>确认开料</span></a>
									<a class="button-small" href="javascript:void(0)" onclick="this.blur(); window.location='${pageContext.request.contextPath }/pages/business/Cutting.do?act=get&cutting.id=${cutting.id }&order_shoe_id=${order_shoe_id }'; return false;"><span>修改</span></a>
									<a class="button-small" href="javascript:void(0)" onclick="this.blur(); deleteOne('${pageContext.request.contextPath }/pages/business/Cutting.do?act=del&id=${cutting.id }&order_shoe_id=${order_shoe_id  }'); return false;"><span>删除</span></a>
								</c:if>
								<c:if test="${cutting.status == 1}">
									<a class="button-small" href="${pageContext.request.contextPath }/pages/business/Cutting.do?act=output&cutting.id=${cutting.id }&order_shoe_id=${order_shoe_id }" target="_blank" ><span>打印生产流程单</span></a>
									<a class="button-small" href="javascript:void(0)" onclick="this.blur(); window.location='${pageContext.request.contextPath }/pages/business/Cutting.do?act=save&cutting.id=${cutting.id }&order_shoe_id=${order_shoe_id }&status=2'; return false;"><span>完成开料</span></a>
								</c:if>
								<c:if test="${cutting.status == 2}">
									<a class="button-small" href="${pageContext.request.contextPath }/pages/business/Cutting.do?act=output&cutting.id=${cutting.id }&order_shoe_id=${order_shoe_id }" target="_blank" ><span>打印生产流程单</span></a>
								</c:if>
							</td>
						</tr>
					</c:if>
				</c:forEach>
			</form>
		</tbody>
		<tfoot>
			<tr class="tableController_bottom">
				<td colspan="14" align="center">
					<jsp:include page="../../../include/SplitPage.jsp">
						<jsp:param name="pager" value="${action.pager}"/>
					</jsp:include>
				</td>
			</tr>
		</tfoot>
	</table>
  </body>
</html>
				